<?php
/**
 */
class MemberStatusTable extends Doctrine_Table
{
	public function blockUser($receiver_id,$sender_id)
	{
		
					
		$MemberStatus = new MemberStatus();
		$MemberStatus ->ito_memid = $receiver_id;
		$MemberStatus ->ifrom_memid = $sender_id;
		$MemberStatus ->mem_status = $block;
		$MemberStatus ->createdtime = date('Y-m-d H:i:s');
		//echo '<pre>';print_r($Expressions);exit;
		$MemberStatus ->save();
		return $MemberStatus->iId;
	}
	public function getBlockId($ito_memid,$ifrom_memid)
	{
		
					
			$query=new Doctrine_Query();
		    $query->select('m.*')
		       ->from('MemberStatus m')
			   ->where("m.ito_memid='".$ito_memid."'")
			   ->andWhere("m.ifrom_memid='".$ifrom_memid."'");
			     //echo $query->getSqlQuery();;exit;
			   	$result = $query->execute(array(),Doctrine::HYDRATE_ARRAY);
				//echo '<pre>';print_r($result);exit;
				return $result;
	}
	public function getBlockedIds($receiver_id)
	{
		
					
			$query=new Doctrine_Query();
		    $query->select('m.ifrom_memid')
		       ->from('MemberStatus m')
			   ->where("m.ito_memid='".$receiver_id."'");
			     //echo $query;exit;
			   	$result = $query->execute(array(),Doctrine::HYDRATE_ARRAY);
				//echo '<pre>';print_r($result);exit;
				return $result;
	}
	public function unBlockUserIds($memid,$status,$block_ids)
	{
		$query = new Doctrine_Query();
		$query->update('Memberstatus')
			  ->set('mem_status',"'$status'")
			  ->where("ifrom_memid IN (".$block_ids.")")
			  ->andWhere("ito_memid='".$memid."'");
			  //echo $query;exit;
		return $query->execute();
	}
}